package com.wnhz.work.yz.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.wnhz.work.yz.BaseActivity;
import com.wnhz.work.yz.MyApplication;
import com.wnhz.work.yz.R;
import com.wnhz.work.yz.view.CircularImage;

import org.xutils.x;

/**
 * ---会员中心
 */
public class MemberCenterActivity extends BaseActivity implements View.OnClickListener {
    private TextView title;
    private TextView title_right;

    private RelativeLayout rl_aService, rl_bService;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_member_center);
        initData();
        initView();
    }

    private String name, class_name, personImg;

    private void initData() {
        name = getIntent().getStringExtra("name");
        class_name = getIntent().getStringExtra("class_name");
        personImg = getIntent().getStringExtra("personImg");

    }

    private void initView() {
        title = (TextView) findViewById(R.id.view_main_middle_title);
        title.setText("会员中心");
        findViewById(R.id.btn_main_left).setOnClickListener(this);
//        findViewById(R.id.submit).setVisibility(View.VISIBLE);
        findViewById(R.id.submit).setOnClickListener(this);
        findViewById(R.id.submit).setVisibility(View.GONE);
        title_right = (TextView) findViewById(R.id.submit);
        title_right.setVisibility(View.GONE);
        title_right.setTextColor(0xff008c99);
        // title_right.setText("说明");

        /*rl_aService = (RelativeLayout) findViewById(R.id.rl_aService);
        rl_bService = (RelativeLayout) findViewById(R.id.rl_bService);*/

        findViewById(R.id.rl_member_benefit).setOnClickListener(this);//会员权益
        findViewById(R.id.rl_birthday).setOnClickListener(this);//生日特权
        findViewById(R.id.rl_gift).setOnClickListener(this);//节日小礼物
        findViewById(R.id.rl_travel).setOnClickListener(this);//年度假日游
        findViewById(R.id.rl_time_limit).setOnClickListener(this);//会员限时价
        findViewById(R.id.upgrade).setOnClickListener(this);//会员升级
        findViewById(R.id.rl_under_member).setOnClickListener(this);//名下会员
        /*rl_aService.setOnClickListener(this);//A级服务商
        rl_bService.setOnClickListener(this);//B级服务商
        findViewById(R.id.rl_cooperation).setOnClickListener(this);//战略合作伙伴
        findViewById(R.id.rl_seed).setOnClickListener(this);//种子会员*/
        CircularImage iv_head = (CircularImage) findViewById(R.id.iv_head);
        x.image().bind(iv_head, personImg);
        TextView tv_name = (TextView) findViewById(R.id.tv_name);
        tv_name.setText(name);
        TextView tv_member = (TextView) findViewById(R.id.tv_member);
        tv_member.setText(class_name);
        if (MyApplication.getInstance().getUserBean().getIs_c().equals("1")) {
            findViewById(R.id.rl_under_member).setVisibility(View.GONE);
        } else {
            findViewById(R.id.rl_under_member).setVisibility(View.VISIBLE);
        }


    }

    @Override
    public void onClick(View v) {
        Intent intent;
        switch (v.getId()) {
            case R.id.btn_main_left:
                finish();
                break;

            //说明
            case R.id.submit:
                //   MyToast("说明");
                break;

            //会员权益
            case R.id.rl_member_benefit:
                //MyToast("会员权益");
                break;

            //生日特权
            case R.id.rl_birthday:
                //  MyToast("生日特权");
                break;

            //节日小礼物
            case R.id.rl_gift:
                //   startActivity(new Intent(this, HeelerUserActivity.class));
                //  MyToast("节日小礼物");
                break;

            //年度假日游
            case R.id.rl_travel:
                //  MyToast("年度假日游");
                break;

            //会员限时价
            case R.id.rl_time_limit:
                //  MyToast("会员限时价");
                break;

            case R.id.upgrade://升级
                startActivity(new Intent(this, UserUpgradeActivity.class));
                break;

            //名下会员
            case R.id.rl_under_member:
                intent = new Intent(this, UnderMemberActivity.class);
                startActivity(intent);
                break;

            /* //A级服务商
            case R.id.rl_aService:
                MyToast("A级服务商");
                break;

             //B级服务商
            case R.id.rl_bService:
                MyToast("B级服务商");
                break;

            //战略合作伙伴
            case R.id.rl_cooperation:
                MyToast("战略合作伙伴");
                break;

            //种子会员
            case R.id.rl_seed:
                MyToast("种子会员");
                break;*/

            default:
                break;
        }
    }
}
